package org.icosagon.core.dice;

import java.util.Random;

/**
 *
 * @author Daniel Owens
 */
public class Die {
    private int max = 0;
    
    public Die(int value) {
        this.max = value;
    }
    
    public int roll() {
        Random die = new Random();
        return die.nextInt(max+1);
    }
    
    public int getSides() {
        return this.max;
    }
    
    @Override public String toString() {
        if(max == 100)
            return "percentile";
        return "d"+String.valueOf(max);
    }

    public boolean equals(Die die) {
        if(die.getSides() == this.max)
            return true;
        return false;
    }
}